FROM backend_fastapi:base  as builder

COPY ./ /ygcrm_fastapi
WORKDIR /ygcrm_fastapi

ENV PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
ENV PIP_TRUSTED_HOST=mirrors.tuna.tsinghua.edu.cn
RUN pip install --no-cache-dir poetry==1.8.5 \
    && poetry export --without-hashes -f requirements.txt --output requirements.txt \
    && echo 'ok'
#    && pip install --no-cache-dir -r requirements.txt


#RUN pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple && \
#pip config set install.trusted-host mirrors.tuna.tsinghua.edu.cn  && \
#pip install poetry==1.8.5  && \
#poetry export --without-hashes -f requirements.txt --output requirements.txt && \
#pip install -r requirements.txt
##pip install -r requirements.txt --index-url http://qzj.com:3141/root/pypi/+simple/ --trusted-host qzj.com
## poetry install
##poetry install --no-root --only main


FROM python:3.11.3-slim
MAINTAINER Tony <wuyong@winning.com.cn>

COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin/ /usr/local/bin/
COPY --from=builder /ygcrm_fastapi /ygcrm_fastapi
WORKDIR /ygcrm_fastapi
USER root
EXPOSE 8000

# 设置容器启动时运行的命令
CMD ["python", "run.py"]




